/**
 * Created by wanghuan on 2017/4/9.
 */

/*==========================companySetting 相关接口==============================*/

import Ajax from '../../apiAjax';

export  default {
  state:{
    companyTimeSetting:{}

  },
  mutations:{
    setCommonStateData(state,{key,data}){
      state[key] = data;
    }
  },
  actions:{
    getCompanyTimeSetting({commit},paramData){
      return new Promise((resolve, reject) => {
        Ajax({
          url:'/time/companysetting/getCompanysetting',
          type:'get',
          data:paramData,
          success:function (data) {
            console.log(data)
            commit('setCommonStateData',{key:'companyTimeSetting',data:data.data});
            resolve(data);
          }
        })
      })
    },
    saveCompanyTimeSetting({commit},paramData){
      return new Promise((resolve, reject) => {
        Ajax({
          url:'/time/companysetting/saveCompanysetting',
          data:JSON.stringify(paramData),
          contentType: "application/json;charset=UTF-8",
          success:function (data) {
            resolve(data);
          }
        })
      })
    },
  },
  getters: {
    companyTimeSetting:(state, getters)=> {
      return state.companyTimeSetting;
    }
  }
}
